//
//  PartPayBottomView.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2019/1/4.
//  Copyright © 2019 Gox_WallyDiao. All rights reserved.
//

import UIKit

protocol PartPayBottomViewDelegate:NSObjectProtocol {
    func BuyRightBtnAction(tag:Int)
}

class PartPayBottomView: UIView {
    var delegate:PartPayBottomViewDelegate?
    
    lazy var leftBtn:UIButton = {
        let button = UIButton(type: UIButton.ButtonType.custom)
        button.frame = FRAME_CGFloat(0, 0, SCREEN_WIDTH / 2, 54)
        button.setTitle("购买全集", for: .normal)
        button.addTarget(self, action: #selector(buyBtnAction), for: .touchUpInside)
        button.backgroundColor = WhiteBackColor
        button.setTitleColor(BlackBackColor, for: .normal)
        button.titleLabel?.font = FONT(18)
        button.tag = 11
        return button
    }()
    
    lazy var rightBtn:UIButton = {
        let button = UIButton(type: UIButton.ButtonType.custom)
        button.frame = FRAME_CGFloat(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, 54)
        button.setTitle("购买选中", for: .normal)
        button.addTarget(self, action: #selector(buyBtnAction), for: .touchUpInside)
        button.backgroundColor = TabbarTintColor
        button.titleLabel?.font = FONT(18)
        button.setTitleColor(WhiteBackColor, for: .normal)
        button.tag = 12
        return button
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setUI() {
        
        self.addSubview(leftBtn)
        self.addSubview(rightBtn)
        
    }
    
    @objc func buyBtnAction(btn:UIButton) {
        delegate?.BuyRightBtnAction(tag: btn.tag)
    }
    
}
